import request from '@/config/axios'

// export type ServiceBasicSetParams = {
//   id: number | undefined
//   name: string
//   servicePartnerId: number
//   password: string
//   contactPhone: string
//   expireTime: string
//   enabled: boolean
//   bindMemberPhone: string
//   servicePartner: boolean
//   directInviteUserId: number
//   availableRebateAmount: number
// }

const ServiceApi = {
  getServicePage: async (params: any) => {
    return request.get({ url: '/system/service-partner/page', params })
  },
  // 根据代理商ID获取关联的服务商列表
  getServiceByAgentId: async (agentId: number, params: any) => {
    return request.post({ url: `/system/service-partner/page/agentId/${agentId}`, data: params })
  },
  createService: async (data: any) => {
    return request.post({ url: '/system/service-partner/create', data })
  },
  updateService: async (data: any) => {
    return request.put({ url: '/system/service-partner/update', data })
  },
  deleteService: async (id: number) => {
    return request.delete({ url: `/system/service-partner/delete?id=${id}` })
  },
  getService: async (id: number) => {
    return request.get({ url: `/system/service-partner/get?id=${id}` })
  },

  rejectServiceWithdraw: async (data: any) => {
    return request.put({ url: '/trade/partner-comm-record/reject', data })
  },
  approveServiceWithdraw: async (id: number) => {
    return request.put({ url: `/trade/partner-comm-record/approve?id=${id}` })
  },
  getServiceRecord: async (id: number) => {
    return request.get({ url: `/trade/partner-comm-record/get?id=${id}` })
  },

  updateServiceRecordTransferred: async (data: any) => {
    return request.put({ url: '/trade/partner-comm-record/update-transferred', data })
  },
  //   服务商提现审核 - 列表
  getServiceWithdrawPage: async (params: any) => {
    return request.get({ url: '/trade/partner-comm-record/page', params })
  },
  //   服务商提现审核 - 成功
  successServiceRecord: async (data: any) => {
    return request.put({ url: `/trade/partner-comm-record/success`, data })
  },
  // trade/partner-comm-record/fail
  // 获取服务商设置
  getServiceBasicSet: async () => {
    return request.get({ url: '/system/service-partner/get-basic-set' })
  },
  // 服务商基础设置
  serviceBasicSet: async (data: any) => {
    return request.post({ url: '/system/service-partner/basic-set', data })
  },
  // 根据手机号关联会员
  getServiceMemberPage: async (params: any) => {
    return request.get({ url: '/system/member-info/page', params })
  },
  // 佣金记录分页
  getServiceRecordPage: async (params: any) => {
    return request.get({ url: '/trade/partner-comm-record/record/page', params })
  }
}
export default ServiceApi
